package cn.stylefeng.guns.sys.modular.system.entity.Enum;

import lombok.Getter;

/**
 * 角色枚举类
 *
 * @author jiangge
 * @Date 2020/9/26 14:45
 */
@Getter
public enum UseEnum {
    ADD("add", "增"),
    DEL("del", "删"),
    EDIT("edit", "改"),
    QUERY("query", "查");

    UseEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    private String code;

    private String msg;

    public static UseEnum getByMsg(String value) {
        for (UseEnum useEnum : values()) {
            if (useEnum.getMsg().equals(value)) {
                return useEnum;
            }
        }
        return null;
    }

    public static UseEnum getByCode(String value) {
        for (UseEnum useEnum : values()) {
            if (useEnum.getCode().equals(value)) {
                return useEnum;
            }
        }
        return null;
    }

}
